package com.example.jpademo.dao;

import com.example.jpademo.model.EtlApp;
import com.example.jpademo.model.EtlAppInfo;
import com.example.jpademo.vo.AppConfVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface EtlAppDao extends JpaRepository<EtlApp,String>, JpaSpecificationExecutor<EtlApp> {
    List<EtlApp> findEtlAppsByCodeIsLike(String code);


    @Query("select new com.example.jpademo.vo.AppConfVo(app.id,info.appId,info.infoName,info.inputDate) from EtlApp app ,EtlAppInfo info where app.id = info.appId")
    Page<AppConfVo> findAppConfVo(PageRequest of);

}
